<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 租还记录</title>

    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">
    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
      
      <div class="row">
          <div class="col-sm-7">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>借还记录详情</h5>
                    </div>
                    <div class="ibox-content">
                        <form method="post" class="form-horizontal" action="" id="myformdata">
                        <input type="hidden" name="id" value="{$list.id}" />
                            <div class="form-group">
                                <label class="col-sm-2 control-label">订单名称</label>
                                <div class="col-sm-10">
                                    <label class="control-label">{$list.lname}</label>

                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商户名称</label>
                                <div class="col-sm-10">
                                    <label class="control-label">{$list.sname}</label>

                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label" >订单ID</label>
                                <div class="col-sm-10">
                                    <label class="control-label">{$list.order_no}</label>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">开始时间</label>
                                <div class="col-sm-10">
                                   <label class="control-label">{$list.starttime|date="Y-m-d H:i:s",###}</label>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">结束时间</label>
                                <div class="col-sm-10">
                                    <input class="form-control layer-date" placeholder="YYYY-MM-DD hh:mm:ss" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" type="text" name="endtime" value="{$list.endtime|date="Y-m-d H:i:s",###}">
                                    <label class="laydate-icon"></label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">订单状态</label>
                                <div class="col-sm-10">
                                    <label class="control-label"><select name="status" class="form-control layer-date">
                                        <option value="1" {if condition="$list['status'] eq '1'"} selected="selected" {/if} >租借中</option>
                                        <option value="2" {if condition="$list['status'] eq '2'"} selected="selected" {/if} >已完成</option>
                                        <option value="3" {if condition="$list['status'] eq '3'"} selected="selected" {/if} >订单超时</option>
                                        <option value="4" {if condition="$list['status'] eq '4'"} selected="selected" {/if} >异常</option>
                                    </select></label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">备注</label>
                                <div class="col-sm-10">
                                    <label class="control-label"><textarea id="ccomment" name="remarks" class="form-control" style="margin: 0px; height: 86px; width: 410px;">{$list.remarks}</textarea></label>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
     
                                    <input type="submit" class="btn btn-primary" value="提交">
                           
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            
            
              <div class="col-sm-5">
                  <div class="ibox float-e-margins">
                      <div class="ibox-title">
                          <h5>更多信息</h5> 
                      </div>
                      <div class="ibox-content">
                        <p><img id="avatar" width=220 height=220 alt="image"  src="{$list.picture}" /></p>
                        <p>&nbsp;</p>
                        <p>用户名：{$list['name']}</p>
                      </div>
                  </div>
              </div>
          
        </div>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/content.min.js?v=1.0.0"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/jquery.validate.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/messages_zh.min.js"></script>
  <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
</body>

</html>
<script>
$(document).ready(function(){
	$("#myformdata").validate({
	  debug:true,
	  submitHandler:function(form){
            save();   
      },    

	function save(){
		var fomrData = $("#myformdata").serialize();
		var action = 'edit';
		$.ajax({
			type : 'POST',
			url : '<?php echo \think\Request::instance()->root(); ?>/ausagent/Leaseorder/' + action,
			dataType : 'json',
			data : fomrData,
			success : function(result) {
				//layer.close(layer1);
				if(0 === result.code) {
						layer.msg(result.msg, {icon: 1});
					}  else  {
						//删除失败
						layer.msg(result.msg, {icon: 5});
					}
			},
			error : function(){
				layer.msg('服务器错误！请稍后重试', {icon: 2});
			}
		})
	};
})
</script>

<script src="{$Think.config.site.resource_url}js/plugins/layer/laydate/laydate.js"></script>
    <script>
        //外部js调用
        laydate({
            elem: '#hello', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
            event: 'focus' //响应事件。如果没有传入event，则按照默认的click
        });

        //日期范围限制
        var start = {
            elem: '#start',
            format: 'YYYY/MM/DD hh:mm:ss',
            min: laydate.now(), //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: true,
            istoday: false,
            choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY/MM/DD hh:mm:ss',
            min: laydate.now(),
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);
    </script>